package com.luckku.boot.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luckku.boot.mapper.CouponMapper;
import com.luckku.boot.mapper.SeckillMapper;
import com.luckku.boot.model.entity.Coupon;
import com.luckku.boot.model.entity.Seckill;
import com.luckku.boot.model.vo.CouponVo;
import com.luckku.boot.service.ICouponService;
import com.luckku.boot.service.ISeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author luckku
 * @date 2021/12/15
 */

@Service
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements ICouponService {

    @Autowired
    CouponMapper couponMapper;

    @Override
    public List<CouponVo> getUserCoupon(String userId) {
        return couponMapper.getUserCoupon(userId);
    }

    @Override
    public List<CouponVo> getUsableCoupon(String userId, Long totalPrice) {
        return couponMapper.getUsableCoupon(userId, totalPrice);
    }

    @Override
    public Page<Coupon> getList(Page<Coupon> page) {
        return this.baseMapper.selectPage(page,new QueryWrapper<>());
    }
}
